home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 April / EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso / EARCD / gfx / board / rtgmv13.lha / goodies / rtggadgets / ihandler.a < prev    next >
Text File  |  1996-06-24  |  3KB  |  93 lines

  1.  ;
  2.  ;  ihandler.a  V1.3
  3.  ;
  4.  ;
  5.  ;  Input Handler for RTGGadgets package
  6.  ;
  7.  ;  Copyright © 1996 by Thomas and Hans-Joerg Frieden
  8.  ;  Written by Thomas and Hans-Joerg Frieden
  9.  ;
  10.  ;  This software may be freely distributed. The copyright remains with
  11.  ;  the copyright holders. For further information, see legal.doc
  12.  ;  In no way may this software be modified without permission of the
  13.  ;  copyright holders.
  14.  ;
  15.  ;  This software is provided "as is", and may only be used at your own risk.
  16.  ;  The copyright holder and/or the authors can not be held responible for any
  17.  ;  damage the usage of this software may cause. To put it in other words, we are not
  18.  ;  responisble if your cat dies while using this software.
  19.  
  20.  
  21.     include "include:exec/types.i"
  22.     include "include:exec/io.i"
  23.     include "include:devices/inputevent.i"
  24.  
  25.  
  26.     STRUCTURE   RTGInpRec,0
  27.         UBYTE   ir_MK1          ; Linke Maustaste
  28.         UBYTE   ir_MK2          ; Mittlere Maustaste
  29.         UBYTE   ir_MK3          ; Rechte Maustaste
  30.         UBYTE   ir_UK1          ; Linke Maustaste
  31.         UBYTE   ir_UK2          ; Mittlere Maustaste
  32.         UBYTE   ir_UK3          ; Rechte Maustaste
  33.         UBYTE   ir_LastKey      ; Letzte gedrückte Taste
  34.         STRUCT  ir_Keys,$60     ; Tasten-Array
  35.         WORD    ir_MouseX       ; X-Mauscoordinate
  36.         WORD    ir_MouseY       ; Y-Mauscoordinate
  37.         LABEL   ir_SIZEOF
  38.  
  39.     section text,code
  40.     ;
  41.     ; Input Handler Code
  42.     ;
  43.     xdef  _HandlerCode
  44.     ;
  45.     ; A0 enthält InputEvent-Kette
  46.     ; A1 enthält den Pointer auf das Daten-Feld
  47.     ;
  48.     ; D0 enhält die (neue) Event-Kette beim Verlassen der Funktion.
  49.     ; Wird in diesem Handler auf NULL gesetzt, damit keine Events
  50.     ; zu Intuition durchkommen (ich sind da ein wenig eigen)
  51.     ;
  52. _HandlerCode:
  53.     move.l  a0,-(sp)
  54. _HandlerCodeLoop:
  55.     cmp.b   #IECLASS_RAWMOUSE,ie_Class(a0)      ; Hat jemand gemaust?
  56.     bne.s   hc_nomouse                          ; Nö, keine Maus
  57.     cmp.w   #IECODE_LBUTTON,ie_Code(a0)         ; Linke Taste ?
  58.     bne.s   hc_lutest                           ; nope
  59.     move.b  #1,ir_MK1(a1)
  60.     bra     hc_NextEvent
  61. hc_lutest:
  62.     cmp.w   #IECODE_LBUTTON+IECODE_UP_PREFIX,ie_Code(a0)   ; Linke Taste hoch ?
  63.     bne.s   hc_rdtest                           ; nope
  64.     move.b  #1,ir_UK1(a1)
  65.     bra     hc_NextEvent
  66. hc_rdtest:
  67.     bra     hc_NextEvent
  68.  
  69. hc_nomouse:
  70.     cmp.b   #IECLASS_RAWKEY,ie_Class(a0)        ; Tastendruck?
  71.     bne.s   hc_NextEvent                        ; Nee, nächsten Event bearbeiten
  72.     move.w  ie_Code(a0),d0                      ; Code rauslesen
  73.     btst    #7,d0                               ; War's ein UP_PREFIX
  74.     beq     hc_noup                             ; Nö. keiner
  75.     moveq   #0,d1
  76.     bra.s   hc_setkey
  77. hc_noup:
  78.     moveq   #1,d1
  79.     move.b  d0,ir_LastKey(a1)                   ; LastKey setzten
  80. hc_setkey:
  81.     and.w   #$7f,d0                             ; evn. UP_PREFIX löschen
  82.     move.b  d1,(a1,d0.w)                        ; Key-Merker setzten
  83.  
  84. hc_NextEvent:
  85.     move.l  (a0),d0
  86.     move.l  d0,a0
  87.     bne.s   _HandlerCodeLoop
  88.  
  89.     move.l  (sp)+,d0
  90.     rts
  91.  
  92.     END
  93.